import 'package:app/util/http.dart';
import 'package:flutter/material.dart';

class MaterialPickApi {

  BuildContext? context;

  static MaterialPickApi of(BuildContext? context) {
    MaterialPickApi materialPickApi = MaterialPickApi();
    materialPickApi.context = context;
    return materialPickApi;
  }

  /// 添加托盘
  Future<dynamic> addContainer(data) async{
    return await ApiService.of(context).put('lgs/material/pick/createContainer', data);
  }

  /// 删除托盘
  Future<dynamic> removeContainer(ids) async {
    return await ApiService.of(context).delete("lgs/material/pick/removeContainer/"+ids);
  }

  /// 保存物料信息
  Future<dynamic> save(data) async {
    return await ApiService.of(context).put("lgs/material/pick/save/", data);
  }

  /// 查询物料信息
  Future<dynamic> materialByCode(code) async{
    return await ApiService.of(context).get("lgs/material/pick/search/"+code);
  }

  /// 查询物料信息
  Future<dynamic> materialByBill(code,billNo) async{
    return await ApiService.of(context).get("lgs/material/pick/search/"+code+"/"+ billNo);
  }

  /// 查询物料列表
  Future<dynamic> materialListByPickId(pickId,container) async{
    return await ApiService.of(context).get("lgs/material/pick/list/"+pickId+"/"+container);
  }

  /// 更新数量
  Future<dynamic> updateItemQty(data) async{
    return await ApiService.of(context).put('lgs/material/pick/updateItemQty', data);
  }

  /// 删除物料
  Future<dynamic> removeMaterial(ids) async{
    return await ApiService.of(context).delete('lgs/material/pick/removeMaterial/'+ids);
  }

}
